import java.util.Scanner;

public class Chapter01 {
    public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    int h=0,k=0;
        while (h<3||k<3) {
        System.out.println("请输入矩形的高度：");
        h = input.nextInt();
        System.out.println("请输入矩形的宽度：");
        k = input.nextInt();
    }
        for (int i =1;i<=h;i++) {
            for (int j = 1; j <= k; j++) {
                if (j == 1 || j == k || i == 1 || i == h) {
                    System.out.print("*");
                } else {
                    System.out.print(" ");
                }
            }
            System.out.print("\n");
        }
    }
}
